package dateBase;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.sports_meet.R;

import java.util.List;

import Judge.JudgeBean;

public class JudgeAdapter extends BaseAdapter {
    private Context mContext;
    private List<JudgeBean> judge_list;

    public JudgeAdapter(Context context, List<JudgeBean> judge_list) {
        this.judge_list = judge_list;
        this.mContext = context;
    }

    @Override
    public int getCount() {
        return judge_list.size();
    }

    @Override
    public Object getItem(int i) {
        return judge_list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }


    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.judge_item, parent, false);
        }

//     获取数据类型的对象
        JudgeBean data = (JudgeBean) getItem(position);

        // 设置视图中的控件的值
        TextView textView1 = convertView.findViewById(R.id.item_1);
        TextView textView2 = convertView.findViewById(R.id.item_2);
        TextView textView3 = convertView.findViewById(R.id.item_3);
        TextView textView4 = convertView.findViewById(R.id.item_4);
        TextView textView5 = convertView.findViewById(R.id.item_5);

        textView1.setText(data.getJno());
        textView2.setText(data.getJname());
        textView3.setText(data.getJage());
        textView4.setText(data.getJsex());
        textView5.setText(data.getJproject());


        return convertView;
    }

}



